<template>
  <div class="write-discuss-container">
    <div class="textarea-block p-7 ">
      <textarea placeholder="快来留下你的回复吧" max="140" v-model="model.discuss"
                class="textarea-item w-100 bg-white"></textarea>
    </div>
    <div class="handle-block d-flex jc-end ai-center p-7 bg-light">
      <div class="letter-num text-info">{{model.discuss.length}}/140</div>
      <button class="submit fs-lg" @tap="submit">发送</button>
    </div>
    <login-box v-if="loginBox" @getUserInfo="agreeGetUserInfo" />
  </div>
</template>
<script>
import { mapGetters } from 'vuex';
import LoginBox from '@/components/LoginBox'
export default {
  components: { LoginBox },
  data() {
    return {
      loginBox: false,
      model: {
        discuss: ''
      }
    }
  },
  computed: {
    ...mapGetters(['openid', 'isGetUserInfo']),

  },
  methods: {
    sendDiscuss() {
    },
    submit() {
      //没有上传过用户信息弹出授权框
      this.isGetUserInfo ? this.sendDiscuss() : this.loginBox = true
    },
    agreeGetUserInfo(userInfo) {
      console.log(userInfo)
      this.loginBox = false
      this.sendDiscuss()
    }
  },
}
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.write-discuss-container {
  width: 100vw;
  min-height: 100vh;
  .textarea-item {
    min-height: 665rpx;
  }
  .submit {
    padding-left: 35rpx;
  }
}
</style>